﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;


namespace MathQ
{
    public partial class ScoreItems : UserControl
    {
        private int _Score = 0;
        private int _goodScoreMin = 85;
        
        public ScoreItems()
        {
            InitializeComponent();
        }


        public void DisplayScore(int totalQs, int wrongQs)
        {
            _Score = (int)Math.Floor(100 - Convert.ToDouble(wrongQs * 100 / totalQs));

            label_CorrectTotal.Text = (totalQs - wrongQs).ToString();
            label_WrongTotal.Text = wrongQs.ToString();
            label_Score.Text = _Score.ToString();

            if (_Score == 100)
            {
                label_Score.ForeColor = Color.LimeGreen;
                pictureBox_flag.Image = (Image)Program._resources.GetObject("Flag_green");
            }
            else if (_Score >= _goodScoreMin)
            {
                label_Score.ForeColor = Color.Blue;
                pictureBox_flag.Image = (Image)Program._resources.GetObject("Flag_blue");
            }
            else
            {
                label_Score.ForeColor = Color.Red;
                pictureBox_flag.Image = (Image)Program._resources.GetObject("Flag_red");
            }

        }


        public Label CorrectTotalLabel
        {
            get { return (this.label_CorrectTotal); }
        }

        public Label WrongTotalLabel
        {
            get { return (this.label_WrongTotal); }
        }

        public Label ScoreLabel
        {
            get { return (this.label_Score); }
        }

        public PictureBox FlagPictureBox
        {
            get { return (this.pictureBox_flag); }
        }

        public int Score
        {
            get { return _Score; }
        }


        public bool IsGoodScore
        {
            get { return (_Score >= _goodScoreMin); }
        }

        
    }
}
